package cc.ucanuup.service.base.impl;

import java.util.HashSet;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cc.ucanuup.service.base.entity.UpUser;
import cc.ucanuup.service.base.inter.UpMenuservice;
import cc.ucanuup.service.base.inter.UpResourceService;
import cc.ucanuup.service.base.inter.UserPowerService;


/**
 * Description: TODO[描述该类概要功能介绍]
 *
 * @author guwenbin
 * @date 2018年2月1日
 * @version 1.0
 */
@Service
public class UserPowerServiceImpl implements UserPowerService {

	@Autowired
	private UpMenuservice upMenuservice;
	@Autowired
	private UpResourceService upResourceService;

	@Override
	public Set<String> getPermissionsByUserAccount(UpUser user) {
		Set<String> permission = new HashSet<String>();
		Set<String> pmenus = upMenuservice.findPermissionsByUserAccount(user);
		Set<String> pres = upResourceService.findResourcePermissionsByUserAccount(user);
		permission.addAll(pmenus);
		permission.addAll(pres);
		return permission;
	}

}
